﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Component.Tools
{
    public class ErrorHandle : Controller
    {
        protected override void OnException(ExceptionContext filterContext)
        {
            //if (!filterContext.ExceptionHandled && filterContext.Exception is ArgumentOutOfRangeException)
            if (!filterContext.ExceptionHandled)
            {
                //页面跳转至Error页面
                filterContext.Result = new RedirectResult("~/Error/error");
                //将异常更改为已处理异常
                filterContext.ExceptionHandled = true;
            }
            base.OnException(filterContext);
        }
    }
}
